package com.cqw.ftp.timers;

import com.cqw.ftp.contant.PreFileName;
import com.cqw.ftp.service.impl.FtpServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Arrays;

@Slf4j
@Component
public class GetFtpFileTask {

    @Resource
    FtpServiceImpl ftpServiceImpl;

    /**
     * 每15分钟从ftp服务器上获取指定文件
     */
    @Scheduled(cron="0 0/15 * * * ?")
    public void scanningFile(){
        ftpServiceImpl.downloadFile(Arrays.asList(PreFileName.FTP_TEST_FILE));
    }
}
